package com.samcai.swiperecyclerview.view;

import android.content.Context;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.samcai.swiperecyclerview.R;


/**
 * 自定义加载View
 * 
 * @author samcai-work
 * @time 2016年2月15日下午2:23:21
 * @version 1.0
 * @describe [nothing]
 */
public class LoaderView extends RelativeLayout {

	// 加载状态进度条
	private ProgressBar mProgressBar;

	// 显示加载状态TextView
	private TextView mTextView;

	public LoaderView(Context context) {

		super(context);
		inflate(context, R.layout.layout_load_state, this);
		mProgressBar = (ProgressBar) findViewById(R.id.load_progressBar);
		mTextView = (TextView) findViewById(R.id.load_tv);
	}

	/**
	 * 隐藏进度条
	 */
	public void hideProgressBar() {

		mProgressBar.setVisibility(View.GONE);
	}

	/**
	 * 显示进度条
	 */
	public void showProgressBar() {

		mProgressBar.setVisibility(View.VISIBLE);
	}

	/**
	 * 设置显示加载状态
	 * 
	 * @param state
	 */
	public void setLoadingStateText(String state) {

		mTextView.setText(state);
	}

}
